aquiandres has quit [Read error: Connection reset by peer]
aquiandres has joined #racket
aquiandres has quit [Quit: Leaving]
aquiandres has joined #racket
aquiandres has quit [Read error: Connection reset by peer]
aquiandres has joined #racket
aquiandres has quit [Read error: Connection reset by peer]
_whitelogger has joined #racket
aquiandres has joined #racket
aquiandres has quit [Quit: Leaving]
YuGiOhJCJ has joined #racket
ZombieChicken has quit [Ping timeout: 256 seconds]
ZombieChicken has joined #racket
ZombieChicken has quit [Ping timeout: 256 seconds]
mahmudov has quit [Ping timeout: 240 seconds]
mzan has joined #racket
acarrico has quit [Ping timeout: 240 seconds]
Fernando-Basso has quit [Remote host closed the connection]
odanoburu has joined #racket
dddddd has joined #racket
iyzsong has quit [Ping timeout: 252 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #racket
acarrico has joined #racket
pie_ has joined #racket
Sgeo has quit [Read error: Connection reset by peer]
Sgeo has joined #racket
jao has joined #racket
Sgeo_ has joined #racket
Sgeo has quit [Ping timeout: 252 seconds]
acarrico has quit [Ping timeout: 268 seconds]
dan_f has joined #racket
dustyweb has joined #racket
<dustyweb>
gosh
<dustyweb>
DOS really breaks my brain
Falacer has joined #racket
dustyweb has quit [Read error: Connection reset by peer]
dddddd has quit [Remote host closed the connection]
mzan has left #racket [#racket]
dan_f has quit [Quit: dan_f]
jsomedon has joined #racket
dbmikus has joined #racket
dustyweb has joined #racket
Fernando-Basso has joined #racket
vraid has joined #racket
jsomedon has quit [Quit: jsomedon]
Falacer has quit [Quit: leaving]
odanoburu has quit [Quit: Connection closed for inactivity]
dbmikus has quit [Quit: WeeChat 1.9.1]
rnmhdn has joined #racket
<rnmhdn>
don't we have anything like list-head in racket?
<lexi-lambda>
rnmhdn: What would that function do?
<rnmhdn>
what list-tail does in the other direction
<lexi-lambda>
Oh, I think you want drop-right.
Sgeo_ has quit [Read error: Connection reset by peer]
<rnmhdn>
yes
<rnmhdn>
thank you.
Sgeo_ has joined #racket
<rnmhdn>
I don't like their naming:-" neither do I like their guide
<rnmhdn>
I think they should include drop-right just after list-tail in their guide
<rnmhdn>
idk
<rnmhdn>
nvm
<rnmhdn>
thanks
<rnmhdn>
I have to write a program that does this:
<rnmhdn>
It takes: '(* + 2 1 / 3 * 2 - 6 1)
<lexi-lambda>
I think list-tail is sort of weird… it’s the same thing as `take`. I think it’s documented separately because it comes from racket/base, but the others don’t.
pie_ has quit [Ping timeout: 252 seconds]
<rnmhdn>
oh
<rnmhdn>
It takes that and calculates 9/10 as the result
<rnmhdn>
do you understand how?
<rnmhdn>
now I'm thinking that I would start from the end of the list and find the first operator and eval that operator with the next two numbers after it and I repeat this until I get to a single number
<rnmhdn>
Is this the racket way of making such program?
<rnmhdn>
I'm not so experienced with functional programming
<rain1>
I would recommend starting at the front of the list
<rnmhdn>
I mean is this also how you people would approach such a problem?
<rnmhdn>
rain1: and then what?
<rain1>
it's a little bit tricky if you're a beginner
<lexi-lambda>
I don’t think you should ever use eval unless you are implementing DrRacket.
<rnmhdn>
lexi-lambda: then what should I do?
<lexi-lambda>
I would make a hash table that maps operator symbols to functions.
<rain1>
but basically you would like to have a function that reads a 'thing' from the list, and returns the rest of the list
<lexi-lambda>
Or just a function that uses `case` or `match` to map a symbol to its function.
<rain1>
so (f '(1 2 3)) would return 1 and (2 3). and (f '(+ 2 1 x y z)) would return 3 and (x y z)
<rain1>
do you see what i mean?
<rain1>
[and i agree that you wont need to use EVAL here]
<rnmhdn>
and what would (f '(+ - 1 2 3)) return?
<rnmhdn>
I think I should start from the end of the list
<rain1>
that would return 2 and '()
<rnmhdn>
but how?
<rnmhdn>
my idea is that my program would find that -
<rnmhdn>
and then replace - 1 2 with -1
<rain1>
So you have got a different approach to the problem and I think that's good and you could work on that way!
<rnmhdn>
so It gets to '(+ -1 3) which is 2
<rain1>
I was just talking about the way I thought to do it
<rnmhdn>
rain1: I don't understand how your approach could be implemented
<rnmhdn>
how does f calculate 2 from '(+ - 1 2 3)?
<rain1>
2 is the correct result isn't it?
<rain1>
just checking in case i got it wrong
<rnmhdn>
from my understanding it should return '(+ - 1) and (2 3)
<rnmhdn>
yes 2 is the correct result
<rain1>
the idea is that f would see the + and try to read off two 'things' from the list and then add them
<rnmhdn>
lexi-lambda: I don't understand why I shouldn't use eval here