|
tef posted:3. strings *almost* behave like lists, implying array like access (untrue), curious about what you'd prefer for these two. for (1), java-style getChar()? for (2)... honestly I'd need to see an example. (agreed with the others at least.) yaoi prophet posted:what languages are these second one is python
|
# ? Oct 9, 2013 18:05 |
|
|
# ? May 26, 2024 23:42 |
|
Malcolm XML posted:also (paging tef) whats a good intro to prolog/logic programming book not tef but: http://www.amazon.com/dp/0321417461/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&colid=M55D5Z0NCMZY&coliid=IA5PYLPRXEE1M and http://www.amazon.com/Art-Prolog-Ad...s=art+of+prolog are both recommended the second one "Art of Prolog", make sure you get a recent version. the version i have has shitloads of errata in it.
|
# ? Oct 9, 2013 18:10 |
|
yaoi prophet posted:what languages are these first is ruby. 1. ruby only has require. there is no namespaces, only classes. coming from python where import foo means 'import foo.py in the search path, and bind it to foo locally', to 'require foo' meaning 'run all of this script in the same environment', it's a bit filthy. 2. the defacto standard library is activesupport. everyone ends up including it, if only to ensure that it won't break when someone else does it. 3. ruby has a shitton of "dsls" written using ruby syntax, but overloading the language semantics. last check on number of languages in rails was 12 or so. 4. if you use require, it can define any class or method, or redefine any class or method. class names and package names can be different too. 5. ruby has strings with an optional encoding, and when you concat them, it uses magic rules to make it usually work except when it doesn't second is python. PleasingFungus posted:curious about what you'd prefer for these two. for (1), java-style getChar()? for (2)... honestly I'd need to see an example. i reckon we should treat strings as mostly opaque blobs, not as arrays or lists, and expose iterators, rather than an lookup by index. strings in python don't behave or perform in the same way as lists do. it's just a bad hack from the ascii age. - as mentioned, getchar is always going to have to a full scan if it's using utf-8, or utf-16 internally, so treating it like an index into an array is broken. so strings don't have the same performance characteristics as arrays. - python currently treats strings as sequences, which return strings. so "foo"[0] is the string "f", "foo"[0][0] is also the string "f" too. what should be getting an character instead is returning a substring. it's as if it would be ok for [1,2,3][0] to return [1]. - if you put a string into something that handles lists, something will break subtly, often hitting the recursion limit. this means people end up littering code with isinstance checks to say 'hold up, is this a real list or a string'. some weird things can happen in python when you assume strings are just lists of characters too, like reversing a string: code:
instead of pretending strings are lists, when they don't perform or behave like lists, you can use methods to convert a string into a list, or a generator. i.e, strings could have methods like .codepoints(), .chars(), .words(), or .lines(), rather than the lovely world of a for loop, explicit counter, and getChar. making the list conversion explicit can handle some of the unicode issues for you. the above example could be "".join(reversed(foo.chars()), and not be as broken. you could even have named parameters for some of the edge cases. and that's still with some underlying assumptions about language (ha! words! ha!). and we haven't even begun to talk about string normalization yet. tef fucked around with this message at 19:17 on Oct 9, 2013 |
# ? Oct 9, 2013 18:30 |
|
i bought the art of prolog its pretty good but doesn't gently caress around and dives into things really quickly
|
# ? Oct 9, 2013 18:31 |
|
i have a dumb programming question. has anyone messed with neural network things before? why are people using linked hardware to try to simulate, why cant u just abstract the neurons with C++ objects or something on one computer with a shitton of ram
|
# ? Oct 9, 2013 18:34 |
|
Malcolm XML posted:also (paging tef) whats a good intro to prolog/logic programming book art of prolog is a great book, but it's quite big, but wonderfully through. if you're wanting a taste, i would imagine the reasoned schemer might be more interesting, as I believe it's the source of miniKanren
|
# ? Oct 9, 2013 18:35 |
|
oh it seem i can't post broken unicode reb̈u in a code block
|
# ? Oct 9, 2013 19:16 |
|
tef posted:1. ruby only has require. there is no namespaces, only classes. coming from python where import foo means 'import foo.py in the search path, and bind it to foo locally', to 'require foo' meaning 'run all of this script in the same environment', it's a bit filthy. this sounds like how php does it, which so far i definitely prefer to python style modules. what are you supposed to do when you want to screw with the global namespace from within a "module"? tef posted:- as mentioned, getchar is always going to have to a full scan if it's using utf-8, or utf-16 internally, so treating it like an index into an array is broken. so strings don't have the same performance characteristics as arrays. this does not really sound like an argument against treating strings as a list, it sounds like an argument against using weird encodings. the natural definition of a string is a sequence of characters. if you can't tell what character is at a given index just by doing a simple multiplication operation your encoding is bad and dumb tef posted:- python currently treats strings as sequences, which return strings. so "foo"[0] is the string "f", "foo"[0][0] is also the string "f" too. what should be getting an character instead is returning a substring. it's as if it would be ok for [1,2,3][0] to return [1]. this is definitely correct as working. strings subdivide into strings, and a character is just a string of length 1. any distinction between a character and a string is just a silly artifact of the underlying implementation. that analogy doesn't work because the 0th element of [1,2,3] isn't [1], it's 1, but the 0th element of "foo" is "f". tef posted:some weird things can happen in python when you assume strings are just lists of characters too, like reversing a string: that looks like it did exactly what it was supposed to: reverse the order of the characters in the string. the actual problem here is that string is something weird and nonstandard instead of [0x97, 0x62, 0x65, 0x72]
|
# ? Oct 9, 2013 19:17 |
|
Socracheese posted:i have a dumb programming question. has anyone messed with neural network things before? Handbook of Neuroevolution Through Erlang I bought it but have read only like 1/10 of it so far
|
# ? Oct 9, 2013 19:19 |
|
tef posted:art of prolog is a great book, but it's quite big, but wonderfully through. if you're wanting a taste, i would imagine the reasoned schemer might be more interesting, as I believe it's the source of miniKanren you can also get william byrd's ph.d. dissertation: https://scholarworks.iu.edu/dspace/bitstream/handle/2022/8777/Byrd_indiana_0093A_10344.pdf and cause i'm a clojure fag, dissect the core.logic package: https://github.com/clojure/core.logic
|
# ? Oct 9, 2013 19:20 |
|
i love you php shaggar
|
# ? Oct 9, 2013 19:22 |
|
I'd honestly never thought about the impact of unicode on string operation performance characteristics. (much less that reversed() example.) interesting. it feels like a design decision that made (more) sense back in the python 1/2 days, before strings were unicode by default. now that they are... hm. (the issues distinguishing between strings & lists isn't something that I've encountered myself, so I don't weight that quite as highly... but I do get that it can cause trouble. I remember you brought it up the last time we had this discussion.) still curious about your point 5, dynamically scoped variables rather than singletons.
|
# ? Oct 9, 2013 19:25 |
|
PleasingFungus posted:I'd honestly never thought about the impact of unicode on string operation performance characteristics. (much less that reversed() example.) interesting. you have come to a world called unicode *whipcrack* yep, unless you're a racist, you're gonna have to deal with those 'funny' characters. quote:(the issues distinguishing between strings & lists isn't something that I've encountered myself, so I don't weight that quite as highly... but I do get that it can cause trouble. I remember you brought it up the last time we had this discussion.) this is a personal issue I have. for example, there are some apis where you want to say do foo(a="...") or foo(a=["aaa", "aaa"]) if this were say foo(a=1) foo(a=[1,2,3]), the usual python idiom would work: a for loop in a try/except. other people avoid this by either having two different parameters, or always taking a list, so you have to do foo(a=["aaa"]). the problem is that if you mistakenly do foo(a="aaa"), it sees ["a","a","a"]. so defensive code has to put in explicit checks. when python shifted to unicode, many of these defensive checks did isinstance(..., str), and so broke on unicode. it's a sort of "when it quacks like a duck, looks like a duck, but it's not a duck" moment backfiring. because strings almost behave like lists, you have to introduce special case code, and this special case code makes the libraries harder to update in light of changes. quote:still curious about your point 5, dynamically scoped variables rather than singletons. this is more of a wishlist, but for example, in python with threads, you can't override stdin/stdout per thread. you can't overwrite it without affecting something else. meanwhile, if it were say a global variable, which was dynamically scoped, it would be less of an issue. for ex, say you used %foo to mean 'global + dynamic', you could override things by doing foo(1,2,3, %stdin=.....) for the duration of that function call. i kinda think that globals, like process wide state, should be overridable on the call stack, rather than only being able to be changed process wide, because it's nice for testing or changing things. this is more of a 'this would be nice and i think it would work out ok', but if you got rid of threading, then it's a moot point.
|
# ? Oct 9, 2013 19:50 |
|
Tiny Bug Child posted:this sounds like how php does it, which so far i definitely prefer to python style modules. what are you supposed to do when you want to screw with the global namespace from within a "module"? code:
quote:this does not really sound like an argument against treating strings as a list, it sounds like an argument against using weird encodings. i know but some of us aren't racist
|
# ? Oct 9, 2013 19:52 |
|
ty i am still getting my python "bearings" so to speak. it is often a weird and unintuitive language but i guess that's the price you pay for speed. tef posted:i know but some of us aren't racist look at this shameful race-baiting. there's nothing racist about it. unicode is bad; if you really need to use strange characters chances are they're in some *actual* code page; i mean i know for a fact there's at least 437 of them, so anything ppl actually use is going to be in there somewhere. and if you've run into a use case where that's necessary chances are you already know you're making a page for eastern moldavia or whatever so you can just go ahead and use the proper one
|
# ? Oct 9, 2013 20:03 |
|
💩
|
# ? Oct 9, 2013 20:10 |
|
Tiny Bug Child posted:ty i am still getting my python "bearings" so to speak. it is often a weird and unintuitive language but i guess that's the price you pay for speed. wot
|
# ? Oct 9, 2013 20:13 |
Tiny Bug Child posted:you already know you're making a page for eastern moldavia or whatever so you can just go ahead and use the proper one or skip the website entirely because noone in Moldova owns a computer let alone has internet access
|
|
# ? Oct 9, 2013 20:17 |
|
OBAMA BIN LinkedIn posted:or skip the website entirely because noone in Moldova owns a computer let alone has internet access whoa watch out comrade or the hyper PC squad will run you in for thinkcrime
|
# ? Oct 9, 2013 20:21 |
|
shrughes posted:C++: 6. single argument constructors aren't explicit by default 7. interaction between implicit conversion, ADL, and templates is basically a giant mystery box 8. std::future isn't composable 9. they forgot to add std::make_unique 10. std::vector<bool>
|
# ? Oct 9, 2013 20:24 |
|
refinements (which allows you to monkeypatch a module without "exporting" those monkeypatches) are coming in mri 2.1 but the last time they were candidates for inclusion they had hilarious performance implications. maybe this was somehow addressed also i watched a simon peyton-jones talk about lenses in haskell and i think i might "get" them now. and it makes me feel like less of an idiot that SPJ also tends to writes haskell in pointful style http://skillsmatter.com/podcast/scala/lenses-compositional-data-access-and-manipulation
|
# ? Oct 9, 2013 20:43 |
|
New JSON standard is out. They still went with the railroad diagrams. I hoped they'd at least specify that object names need to be unique and if there are duplicates whether you drop them, accept the first one or the last one, or deny all input. This poo poo is still unspecified and implementation-dependent.
|
# ? Oct 9, 2013 20:50 |
|
MononcQc posted:New JSON standard is out. wtf is a "solidus character" and a "reverse solidus character". those are called slashes, ecma ppl
|
# ? Oct 9, 2013 20:55 |
|
MononcQc posted:New JSON standard is out. has anyone pointed out that the standard is called ECMA-404
|
# ? Oct 9, 2013 20:56 |
|
Tiny Bug Child posted:ty i am still getting my python "bearings" so to speak. it is often a weird and unintuitive language but i guess that's the price you pay for speed. hate to break it to you: python is one of the slowest languages ever the weird and unintuitive stuff is there because Guido liked it that way, pretty much never for performance Tiny Bug Child posted:look at this shameful race-baiting. there's nothing racist about it. unicode is bad; if you really need to use strange characters chances are they're in some *actual* code page; i mean i know for a fact there's at least 437 of them, so anything ppl actually use is going to be in there somewhere. and if you've run into a use case where that's necessary chances are you already know you're making a page for eastern moldavia or whatever so you can just go ahead and use the proper one using codepages and ascii variants is not so bad for european languages. the non-unicode options for CJK and other asian stuff are really, really bad. also, without unicode, what do you do when you need to mix codepages in a string or document? in either case, you will have tons of special case code for encoding quirks. i would rather just have special-case code for unicode quirks and handle all languages at once
|
# ? Oct 9, 2013 20:57 |
|
Tiny Bug Child posted:wtf is a "solidus character" and a "reverse solidus character". those are called slashes, ecma ppl uh no slash is when you write fanfiction w/gay relationships. i'd know
|
# ? Oct 9, 2013 20:58 |
|
MononcQc posted:Handbook of Neuroevolution Through Erlang this looks p sw8, thx
|
# ? Oct 9, 2013 20:59 |
|
MononcQc posted:New JSON standard is out. Is there ever a reason to use rr diagrams instead of bnf outside of a tutorial document?
|
# ? Oct 9, 2013 21:23 |
|
the ones in http://dev.w3.org/csswg/css-syntax/ are p. sweet
|
# ? Oct 9, 2013 21:28 |
|
MononcQc posted:New JSON standard is out. cool 14 page """standard"""
|
# ? Oct 9, 2013 21:29 |
|
three of those pages are empty
|
# ? Oct 9, 2013 21:29 |
|
should i actually make an effort to learn scala
|
# ? Oct 9, 2013 21:31 |
|
no
|
# ? Oct 9, 2013 21:32 |
|
someone posted this a couple pages back, it is hilarious and taught me as much about scala as i will ever need to knowquote:As my team navigated these waters, they would occasionally ask things like: "So this one guy says the only way to do this is with a bijective map on a semi-algebra, whatever the hell that is, and this other guy says to use a library which doesn't have docs and didn't exist until last week and that he wrote. The first guy and the second guy seem to hate each other. What's the Scala way of sending an HTTP request to a server?"
|
# ? Oct 9, 2013 21:43 |
yeah don't kid yourself into thinking you can actually do anything useful in a useless dead language
|
|
# ? Oct 9, 2013 21:45 |
|
OBAMA BIN LinkedIn posted:yeah don't kid yourself into thinking you can actually do anything useful in a useless dead language like c++?
|
# ? Oct 9, 2013 21:46 |
if you cannot program in c++ then you should not be programming anything
|
|
# ? Oct 9, 2013 21:47 |
|
Tiny Bug Child posted:python Tiny Bug Child posted:speed hahahahaha
|
# ? Oct 9, 2013 21:56 |
|
OBAMA BIN LinkedIn posted:if you cannot program in c then you should not be programming anything ftfy, cmon be reasonable
|
# ? Oct 9, 2013 21:59 |
|
|
# ? May 26, 2024 23:42 |
|
OBAMA BIN LinkedIn posted:if you cannot program in c++ then you should not be programming anything no one can craft correct programs in c++ c++ devs imagine they can the rest of us already know that's not true
|
# ? Oct 9, 2013 22:05 |